package ${content.base.basePacket!}.common.domain<#if content.base.module?exists>.${content.base.module}</#if>;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * ${content.entity.tableName!}实体类
 *
 * @author  : ${content.base.author!}
 * @version : ${content.base.version!}
 * @date    : ${content.base.createTime!}
 */
@Entity
@Table(name = "${content.entity.tableName!}")
@TableName("${content.entity.tableName!}")
public class ${content.entity.className!} implements Serializable  {
	private static final long serialVersionUID = 1L;
<#list content.entity.attrs as item>
  <#if item.columnName==content.entity.primaryKey>
 	@Id
 	@GenericGenerator(name = "uuid2", strategy = "uuid2")
 	@GeneratedValue(generator = "uuid2")
 	@TableId(value = "${item.columnName!}")
 	@Column(name = "${item.columnName!}", nullable = false)
	@Param("编号")
 	private ${item.javaType} ${item.field};

  <#else>
	/** ${item.columnName!} - ${item.remarks!} */
	@TableField(value = "${item.columnName!}")
	@Column(name = "${item.columnName!}"<#if !item.nullable>, nullable = false</#if>)
	@Param("${item.remarks!}")
	private ${item.javaType} ${item.field};

  </#if>
</#list>

<#list content.entity.attrs as item>
	public ${item.javaType} ${item.fget}() {return ${item.field};}
	public void ${item.fset}(${item.javaType} ${item.field}) {this.${item.field} = ${item.field};}

</#list>

	@Override
	public String toString() {
		return "${content.entity.className!} [<#list content.entity.attrs as item>${item.field}=" + ${item.field} + " <#if item?has_next>,</#if> </#list>]";

	}

}
